<?php
/**
 * Created by PhpStorm.
 * User: zlkmu
 * Date: 2018/1/28
 * Time: 22:10
 * 消息分发器，将客户端的请求分发成独立的信息，以便对应进程独立处理
 */

require_once __DIR__ . '/../Protocols/ProtocolAPI.php';
require_once __DIR__ . '/../Protocols/GameType.php';
require_once __DIR__.'/../Channel/Client.php';
require_once __DIR__.'/../Channel/Server.php';
require_once "RouterMsg.php";
class MsgRouteServer{
    public static function msgRouteProcess($clientID, $msg, $remoteIP){
        print_r($_SERVER);
       // print_r($msg);
        $routerMsg = array('clientID'=>$clientID, 'clientMsg'=>$msg, 'remoteIP'=>$remoteIP);
        switch($msg['head_request']){
            case ProtocolAPI::$LOGIN_REQUEST:
                Channel\Client::publish(RouterMsg::$PUBLIC_EVENT, $routerMsg);
                break;
            case ProtocolAPI::$VERSION_CHECK_REQUEST:
                Channel\Client::publish(RouterMsg::$PUBLIC_EVENT, $routerMsg);
                break;
//            case ProtocolAPI::$CHECK_ONLINE_REQUEST:
//                Channel\Client::publish(RouterMsg::$PUBLIC_EVENT, $routerMsg);
//                break;
//
//            case ProtocolAPI::$CREATE_ROOM_REQUEST:
//                Channel\Client::publish(RouterMsg::$PUBLIC_EVENT, $routerMsg);
//                break;
//
//            case ProtocolAPI::$PENGPAI_REQUEST:
//                echo "碰牌请求";
//                Channel\Client::publish(RouterMsg::$MAJONG_EVENT, $routerMsg);
//                break;
//
//            case ProtocolAPI::$LICENSING_RESPONSE:
//                Channel\Client::publish(RouterMsg::$NIUNIU_EVENT, $routerMsg);
//                break;

        }
    }
}



?>